﻿package mortal.game.view.mainUI.shortcutbar
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import mortal.game.cache.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.cd.*;
    import mortal.game.view.pack.data.*;
    import mortal.game.view.skill.*;

    public class ShortcutBarUtil extends Object
    {

        public function ShortcutBarUtil()
        {
            return;
        }// end function

        public static function parseType(param1:Object) : int
        {
            return CDDataType.parseType(param1);
        }// end function

        public static function parseValue(param1:Object)
        {
            if (param1 is SkillInfo)
            {
                return SkillInfo(param1).tSkill.series;
            }
            if (param1 is TSkill)
            {
                return TSkill(param1).series;
            }
            if (param1 is ItemData)
            {
                return ItemData(param1).itemInfo.code;
            }
            if (param1 is PackItemData)
            {
                return PackItemData(param1).itemInfo.code;
            }
            if (param1 is SPet)
            {
                return SPet(param1).publicPet.uid;
            }
            return;
        }// end function

        public static function getSource(param1:Object, param2:int)
        {
            var _loc_5:Object = null;
            var _loc_3:* = int(param1["t"]);
            var _loc_4:* = param1["v"];
            switch(_loc_3)
            {
                case CDDataType.skillInfo:
                {
                    _loc_5 = Cache.instance.skill.getSkillBySerialId(_loc_4);
                    break;
                }
                case CDDataType.itemData:
                {
                    _loc_5 = new ItemData(int(_loc_4));
                    break;
                }
                case CDDataType.petInfo:
                {
                    _loc_5 = Cache.instance.pet.getSpetByUid(String(param1["v"]));
                    break;
                }
                default:
                {
                    break;
                }
            }
            return _loc_5;
        }// end function

    }
}
